package DesignPatern.A06_代理模式.QXB.A04强制代理;

/**
 * @Author: Du
 * @Date: 2021/7/22 9:56
 */
public class GamePlayer implements IGamePlayer
{
    private String name = "";
    //我代理的是谁
    private IGamePlayer proxy = null;
    
    public GamePlayer(String name)
    {
        this.name = name;
    }
    
    @Override
    public void login()
    {
        System.out.println("登录");
    }
    
    @Override
    public void killBoss()
    {
        System.out.println("BOSS");
    }
    
    @Override
    public void update()
    {
        System.out.println("更新");
    }
    
    @Override
    public IGamePlayer getProxy()
    {
        this.proxy = new GamePlayerProxy(this);
        return this.proxy;
    }
    
    public boolean isProxy()
    {
        if (this.proxy == null)
        {
            return false;
        } else
        {
            return true;
        }
    }
}
